#!/bin/sh
if [ "$1" = "-h" ] || [ "$1" = "--help" ];then
echo -e "USAGE:\n./DegradationAnalysis.sh [zkAddr] [NameNodeAddr]\nEGG:\n./DegradationAnalysis.sh 192.168.0.83:2181 hdfs://slave1.htdata.com:8020"
fi
if [ $# -ne 2 ];then
echo "The parameter number is wrong!!!"
exit 1
fi
year=`date -d '1 day ago' +%Y`
month=`date -d '1 day ago' +%m`
day=`date -d '1 day ago' +%d`
daytime=$year-$month-$day
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
hadoop jar $DIR/DegradationAnalysis.jar /tmp/$year/$month/$day /tmp/MetricDegradation/$daytime $1 3
spark-submit --master yarn --num-executors 3 $DIR/DegradationPredict.jar $2/tmp/MetricDegradation $1
echo $?
